package com.yc.sole.erp.request;

import com.yc.sole.framework.validate.SaveGroup;
import com.yc.sole.framework.validate.UpdateGroup;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serializable;

/**
 * Request对象
 *
 * @author yizuomin
 * @date 2024-01-24
 **/
@Data
public class BomReq implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @NotNull(groups = {UpdateGroup.class})
    private Long id;
    /**
     * 材料id
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Long materialId;
    /**
     * 产品id
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Long productId;
    /**
     * 所需数量
     */
    @Min(value = 1, groups = {SaveGroup.class, UpdateGroup.class})
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Integer quantity;
    /**
     * 单位
     */
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String unit;


    /**
     * 获取主键
     *
     * @return
     */
    public Object getPkId() {
        return this.id;
    }
}
